<?php
/**
 * Router class
 *
 *
 * @package    lib
 * @subpackage lib_router
 * @author     Juan Carlos Jarquin (zetta)
 * @author     $LastChangedBy$
 * @version    1.1, SVN: $Id$
 */
class Router
{
  
  /**
   * URI delimiter
   */
  const URI_DELIMITER = '/';
  
  /**
   * @var Router
   */
  private static $instance = null;
  
  /**
   * Constructor Class
   * @return Router
   */
  private function Router()
  {}
  
  /**
   * Get the class instance
   * @return Router
   */
  public function getInstance()
  {
    if (self::$instance == null)
    {
      self::$instance = new Router();
    }
    return self::$instance;
  }
  
  /**
   * Generate the route
   * @param Request $request
   */
  public function assemble(Request $request)
  {
    $url = $request->getPathInfo();
    if(eregi('^/',$url))
      $url = substr($url,1);
    list($controller,$action) = explode(self::URI_DELIMITER,$url,3);
    $request->setParam('controller', $controller);
    $request->setParam('action',$action);
    //$args = 0;
  }

}






